package com.city.service.report.impl;

import com.city.domain.pub.PubUser;
import com.city.domain.report.CtUserBranch;
import com.city.repository.pub.PubUserRepository;
import com.city.repository.report.CtUserBranchRepository;
import com.city.service.report.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private PubUserRepository userR;
    @Autowired
    private CtUserBranchRepository userBranchR;

    @Override
    public String findUserNameById(Integer id) {
        PubUser user = userR.findById(id);
        return user != null ? user.getName() : null;
    }

    @Override
    public PubUser findUserById(Integer id) {
        return userR.findById(id);
    }

    @Override
    public Integer findBranchIdByUserId(Integer userId) {
        return userBranchR.findBranchIdByUserId(userId);
    }
}
